package game.userinteraction;

import game.engine.GameLevel;
import java.util.HashMap;
import java.util.Map;
import javax.swing.Action;
import javax.swing.KeyStroke;


/**
 * @author rwb10
 * 
 */
public class InputHandler {
    private Map<KeyStroke, String> myKeyBindings;
    private Map<String, Action> myActionMap;

    /**
     * Constructor.
     * 
     * @param currentGameLevel Gamelevel that uses the input handler.
     */
    public InputHandler (GameLevel currentGameLevel) {
        myKeyBindings = new HashMap<KeyStroke, String>();
        // Examples:
        // myKeyBindings.put(KeyStroke.getKeyStroke(KeyEvent.VK_W, 0, false),
        // "w");

        myActionMap = currentGameLevel.getActionMap();
        // myActionMap.put("w", wKey);
    }

    /**
     * 
     * @return Get the input map of KeyStrokes to Strings.
     */
    public Map<KeyStroke, String> getInputMap () {
        return myKeyBindings;
    }

    /**
     * 
     * @return Get the action map of Strings to Actions.
     */
    public Map<String, Action> getActionMap () {
        return myActionMap;
    }

    /* Example:
     * final class WKey extends AbstractAction{
     * 
     * @Override
     * public void actionPerformed(ActionEvent e) {
     * //do action when key 'W' is pressd
     * }
     * }
     */
}
